package cc.test.dao;

import cc.test.entity.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserDao {

  private final Map<Integer, User> userMap = new HashMap<>();

  {
    userMap.put(2427, new User(2427, "kaiqi.duan"));
    userMap.put(2456, new User(2456, "yunan.zhang"));
  }

  public User get(int id) {
    return userMap.get(id);
  }

  public List<User> getAll() {
    return new ArrayList<>(userMap.values());
  }

}
